package supermar;
import java.util.Scanner;
public class supermarticket {
    public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
        System.out.print("请录入第一件商品的名称:");
        String goodsName01 = scan.next();
        System.out.print("请录入第一件商品的数量:");
        int goodsQuantity01 = scan.nextInt();
        System.out.print("请录入第一件商品的单价:");
        double goodsPrice01 = scan.nextDouble();
        System.out.println("第一件商品录入成功!");

        System.out.print("请录入第二件商品的名称:");
        String goodsName02 = scan.next();
        System.out.print("请录入第二件商品的数量:");
        int goodsQuantity02 = scan.nextInt();
        System.out.print("请录入第二件商品的单价:");
        double goodsPrice02 = scan.nextDouble();
        System.out.println("第二件商品录入成功!");

        System.out.print("请录入第三件商品的名称:");
        String goodsName03 = scan.next();
        System.out.print("请录入第三件商品的数量:");
        int goodsQuantity03 = scan.nextInt();
        System.out.print("请录入第三件商品的单价:");
        double goodsPrice03 = scan.nextDouble();
        System.out.println("第三件商品录入成功!");

        System.out.println("***欢迎来到旺旺超市***");
        System.out.println("--------------------------");
        System.out.println("商品名称       数量        单价         金额");
        double goodsSubtotal01 = goodsQuantity01 * goodsPrice01;
        double goodsSubtotal02 = goodsQuantity02 * goodsPrice02;
        double goodsSubtotal03 = goodsQuantity03 * goodsPrice03;
        System.out.println(goodsName01+"       " + goodsQuantity01 + "        " + goodsPrice01 + "         " + goodsSubtotal01);
        System.out.println(goodsName02+"       " + goodsQuantity02 + "        " + goodsPrice02 + "         " + goodsSubtotal02);
        System.out.println(goodsName03+"       " + goodsQuantity03 + "        " + goodsPrice03 + "         " + goodsSubtotal03);

        System.out.println("--------------------------");

        int totalQuantity = goodsQuantity01 + goodsQuantity02 + goodsQuantity03;
        double totalAmount = goodsSubtotal01 + goodsSubtotal02 + goodsSubtotal03;
        System.out.println("总数量：" + totalQuantity);
        System.out.println("总金额：" + totalAmount);

        double discountAmount = totalQuantity > 10 || totalAmount > 100 ? totalAmount * 0.5 : totalAmount;
        System.out.println("已优惠金额：" + (totalAmount - discountAmount));
        System.out.println("实付金额：" + discountAmount);
    }
}
